/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.custom.entity;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 编码规则Entity
 * @author Kilo
 * @version 2021-01-22
 */
@Table(name="t_code_rule", alias="a", columns={
		@Column(name="id", attrName="id", label="编号", isPK=true),
		@Column(name="record_type", attrName="recordType", label="单据类型"),
		@Column(name="prefix", attrName="prefix", label="前缀"),
		@Column(name="year_flag", attrName="yearFlag", label="是否添加年份"),
		@Column(name="init_number", attrName="initNumber", label="初始编号"),
		@Column(name="number_length", attrName="numberLength", label="编号长度"),
		@Column(name="current_number", attrName="currentNumber", label="当前编号"),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false, isQuery=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
		@Column(name="remarks", attrName="remarks", label="备注信息", queryType=QueryType.LIKE),
	}, orderBy="a.update_date DESC"
)
public class CodeRule extends DataEntity<CodeRule> {
	
	private static final long serialVersionUID = 1L;
	private String recordType;		// 单据类型
	private String prefix;		// 前缀
	private String yearFlag;		// 是否添加年份
	private Long initNumber;		// 初始编号
	private Long numberLength;		// 编号长度
	private Long currentNumber;		// 当前编号
	
	public CodeRule() {
		this(null);
	}

	public CodeRule(String id){
		super(id);
	}
	
	@NotBlank(message="单据类型不能为空")
	@Length(min=0, max=100, message="单据类型长度不能超过 100 个字符")
	public String getRecordType() {
		return recordType;
	}

	public void setRecordType(String recordType) {
		this.recordType = recordType;
	}
	
	@NotBlank(message="前缀不能为空")
	@Length(min=0, max=20, message="前缀长度不能超过 20 个字符")
	public String getPrefix() {
		return prefix;
	}

	public void setPrefix(String prefix) {
		this.prefix = prefix;
	}
	
	@NotBlank(message="是否添加年份不能为空")
	@Length(min=0, max=1, message="是否添加年份长度不能超过 1 个字符")
	public String getYearFlag() {
		return yearFlag;
	}

	public void setYearFlag(String yearFlag) {
		this.yearFlag = yearFlag;
	}
	
	@NotNull(message="初始编号不能为空")
	public Long getInitNumber() {
		return initNumber;
	}

	public void setInitNumber(Long initNumber) {
		this.initNumber = initNumber;
	}
	
	@NotNull(message="编号长度不能为空")
	public Long getNumberLength() {
		return numberLength;
	}

	public void setNumberLength(Long numberLength) {
		this.numberLength = numberLength;
	}
	
	public Long getCurrentNumber() {
		return currentNumber;
	}

	public void setCurrentNumber(Long currentNumber) {
		this.currentNumber = currentNumber;
	}
	
}